<template>
  <view class="order-item-site">
    <view class="car-info-item">
      <view class="car-info-tag">
        <template v-if="type == 'site'">
          {{ record.sendServiceFlag ? `上门送车` : '到店取车' }}
        </template>
        <template v-else>
          {{ record.returnServiceFlag ? `上门取车` : '到店还车' }}
        </template>
      </view>
      <view class="car-info-content">
        <view class="site-name">
          {{ record[type == 'site' ? 'siteName' : 'returnSiteName'] }}
        </view>
      </view>
    </view>
    <view class="car-info-address" v-if="record[type == 'site' ? 'address' : 'returnAddress']">
      {{ record[type == 'site' ? 'address' : 'returnAddress'] }}
    </view>
  </view>
</template>

<script setup>
import { ref, computed } from 'vue'
const emit = defineEmits(['edit'])
const props = defineProps({
  record: {
    type: Object,
    default: () => {},
  },
  type: {
    type: String,
    default: 'site',
  },
})

// 待排车、待用车时，可变更交车人
// 待排车、待用车、用车中时，可变更还车人
const orderStaffCanClick = computed(() => {
  const orderStatus = props.record.orderStatus
  if (props.type == 'site') {
    return [10, 100].includes(orderStatus)
  } else {
    return [10, 100, 200].includes(orderStatus)
  }
})

// 编辑交还车人
const editOrderStaffFn = () => {
  console.log('编辑交还车人')
  emit('edit')
}
</script>

<style lang="less" scoped>
.car-info-item {
  display: flex;
  align-items: flex-start;
  .car-info-tag {
    height: 40rpx;
    line-height: 38rpx;
    font-size: 22rpx;
    border-radius: 20rpx;
    border: 1rpx solid #9ea5bb;
    padding: 0 12rpx;
    color: #9ea5bb;
    margin-right: 16rpx;
  }
  .car-info-content {
    flex: 1;
    font-size: 24rpx;
    color: #191c27;
    .site-name {
      height: 24rpx;
      line-height: 40rpx;
      margin-right: 64rpx;
      display: inline;
    }
    .staff-name-show {
      display: inline;
      white-space: nowrap;
      .staff {
        display: inline;
        .staff-name {
          display: inline;
          color: #3072f6;
          border-bottom: 1rpx solid #3072f6;
        }
      }
      .staff-disable {
        color: #9ea5bb;
        .staff-name {
          color: #9ea5bb;
          border-bottom: none;
        }
      }
    }
  }
}
.car-info-address {
  background: #eff0f2;
  line-height: 44rpx;
  font-size: 24rpx;
  color: #191c27;
  padding: 0 16rpx;
  margin-top: 20rpx;
}
</style>
